package com.ldtechnologies.springapp.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {
	protected final Log logger = LogFactory.getLog(getClass());
	
	@RequestMapping(value="/hello.htm")
	public ModelAndView handleRequest( HttpServletRequest  request
									 , HttpServletResponse response) 
									   throws ServletException, IOException {
		
		logger.info("Returning hello view");
		return new ModelAndView("hello");
	}
	
	@RequestMapping(value="/hola.htm")
	public ModelAndView hola	( HttpServletRequest  request
								, HttpServletResponse response) 
								  throws ServletException, IOException {
		logger.info("entro al hola");
		return new ModelAndView("hola");
	}
	
	@RequestMapping(value="/hello2.htm")
	public ModelAndView hello	( HttpServletRequest  request
								, HttpServletResponse response) 
								  throws ServletException, IOException {
		
		return this.handleRequest(request, response);
	}	
}
